<template>
  <div class="search-wrapper">
    <el-input
      v-model="value"
      class="input-with-select"
      placeholder="请输入搜索内容"
      v-if="typeof value != 'undefined'"
    >
      <template #append>
        <el-button @click="$emit('search')">
          <el-icon><Search /></el-icon>
        </el-button>
      </template>
    </el-input>
    <el-button type="primary" @click="$emit('click')" v-if="$slots.default">
      <slot></slot>
    </el-button>
  </div>
</template>

<script>
export default {
  name: "Search",
  props: {
    /**
     * 搜索区的值
     */
    value: String,
  },
  setup() {
    return {};
  },
};
</script>

<style lang="scss" scoped>
.search-wrapper {
  height: 50px;
  display: flex;
  align-items: center;
  .input-with-select {
    width: 400px;
    height: 40px;
    margin-right: 20px;
  }
}
</style>